// 模拟后端动态生成路由
import { defineFakeRoute } from "vite-plugin-fake-server/client";

/**
 * roles：页面级别权限，这里模拟二种 "admin"、"common"
 * admin：管理员角色
 * common：普通角色
 */

const monitoringFeedbackRouter = {
  path: "/monitoring0",
  meta: {
    title: "监督反馈管理-动态路由",
    roles: ["admin"]
  },
  children: [
    {
      path: "/monitoring/feedback/index",
      // component: () => import("@/monitoring/feedback/index.vue"),
      name: "Feedback",
      meta: {
        title: "反馈信息",
        roles: ["admin"]
      }
    },
    {
      path: "/monitoring/result/index",
      // component: () => import("@/monitoring/result/index.vue"),
      name: "Result",
      meta: {
        title: "检测结果",
        roles: ["admin"]
      }
    }
  ]
};

export default defineFakeRoute([
  {
    url: "/get-async-routes",
    method: "get",
    response: () => {
      return {
        success: true,
        data: [monitoringFeedbackRouter]
      };
    }
  }
]);
